package com.jingbaoduo.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jingbaoduo.domain.Address;
import com.jingbaoduo.service.AddressService;
import com.jingbaoduo.mapper.AddressMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 1
* @description 针对表【address】的数据库操作Service实现
* @createDate 2023-09-20 11:23:51
*/
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address>
    implements AddressService{

    @Autowired
    private AddressMapper addressMapper;

    public int updateDefault(Address address){

        UpdateWrapper<Address> wrapper = new UpdateWrapper<>();
        wrapper.eq("id",address.getId());
        wrapper.set("is_default",0);

        return addressMapper.update(address,wrapper);

    }
}




